package com.hanyxx.thread;

/**
 * @author layman
 * @date 2021/2/7
 */
public class Demo11 {
    private String name = "layman";

    public void methodA() throws InterruptedException{
            name.wait();
    }
    public void methodB() throws InterruptedException {
        synchronized (name){
            name.wait();
        }
    }
    public static void main(String[] args) throws InterruptedException {
        Demo11 demo = new Demo11();
        demo.methodA();  //Exception in thread "main" java.lang.IllegalMonitorStateException
     // demo.methodB();
    }
}
